{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2024-11-02T02:24:24.898336Z",
     "start_time": "2024-11-02T02:24:24.880333Z"
    }
   },
   "source": "import pandas as pd",
   "outputs": [],
   "execution_count": 11
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-11-02T02:24:25.505847Z",
     "start_time": "2024-11-02T02:24:25.495847Z"
    }
   },
   "cell_type": "code",
   "source": [
    "data_file_15 = './data/15_04.csv'\n",
    "data_file_21 = './data/21_04.csv'\n",
    "save_file_15 = './data/15_05.csv'\n",
    "save_file_21 = './data/21_05.csv'"
   ],
   "id": "c58f9a473fc9b7a8",
   "outputs": [],
   "execution_count": 12
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-11-02T02:24:28.789599Z",
     "start_time": "2024-11-02T02:24:26.410702Z"
    }
   },
   "cell_type": "code",
   "source": [
    "df_15 = pd.read_csv(data_file_15)\n",
    "df_21 = pd.read_csv(data_file_21)"
   ],
   "id": "153dcf1bf7f2021e",
   "outputs": [],
   "execution_count": 13
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-11-02T02:24:29.892384Z",
     "start_time": "2024-11-02T02:24:29.882385Z"
    }
   },
   "cell_type": "code",
   "source": [
    "wind_speed = 'wind_speed'\n",
    "wind_speed_square = 'wind_speed_square'\n",
    "wind_speed_cube = 'wind_speed_cube'\n",
    "def add_wind_speed_features(row):\n",
    "    row[wind_speed_square] = row[wind_speed] ** 2\n",
    "    row[wind_speed_cube] = row[wind_speed] ** 3\n",
    "    \n",
    "    return row"
   ],
   "id": "e202387581173539",
   "outputs": [],
   "execution_count": 14
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-11-02T02:27:54.367934Z",
     "start_time": "2024-11-02T02:24:32.866917Z"
    }
   },
   "cell_type": "code",
   "source": [
    "df_15 = df_15.apply(add_wind_speed_features, axis=1)\n",
    "df_21 = df_21.apply(add_wind_speed_features, axis=1)"
   ],
   "id": "9828ec79caa69453",
   "outputs": [],
   "execution_count": 15
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-11-02T02:28:04.642549Z",
     "start_time": "2024-11-02T02:27:54.368678Z"
    }
   },
   "cell_type": "code",
   "source": [
    "df_15.to_csv(save_file_15, index=False)\n",
    "df_21.to_csv(save_file_21, index=False)"
   ],
   "id": "b9fd6a418f5bbd9e",
   "outputs": [],
   "execution_count": 16
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-11-02T02:33:11.126161Z",
     "start_time": "2024-11-02T02:33:11.116081Z"
    }
   },
   "cell_type": "code",
   "source": [
    "print(df_15.columns)\n",
    "columns_index_dict = {col: i for i, col in enumerate(df_15.columns)}\n",
    "columns_index_dict"
   ],
   "id": "eb5e4f6aad711b64",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Index(['time', 'wind_speed', 'generator_speed', 'power', 'wind_direction',\n",
      "       'wind_direction_mean', 'yaw_position', 'yaw_speed', 'pitch1_angle',\n",
      "       'pitch2_angle', 'pitch3_angle', 'pitch1_speed', 'pitch2_speed',\n",
      "       'pitch3_speed', 'pitch1_moto_tmp', 'pitch2_moto_tmp', 'pitch3_moto_tmp',\n",
      "       'acc_x', 'acc_y', 'environment_tmp', 'int_tmp', 'pitch1_ng5_tmp',\n",
      "       'pitch2_ng5_tmp', 'pitch3_ng5_tmp', 'pitch1_ng5_DC', 'pitch2_ng5_DC',\n",
      "       'pitch3_ng5_DC', 'group', 'label', 'new_group', 'pitch_angle_mean',\n",
      "       'pitch_angle_sd', 'pitch_speed_mean', 'pitch_speed_sd',\n",
      "       'pitch_moto_tmp_mean', 'pitch_moto_tmp_sd', 'tmp_diff', 'torque', 'cp',\n",
      "       'ct', 'lambda', 'r_wind_speed_to_power',\n",
      "       'r_wind_speed_to_generator_speed', 'r_square', 'wind_speed_square',\n",
      "       'wind_speed_cube'],\n",
      "      dtype='object')\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'time': 0,\n",
       " 'wind_speed': 1,\n",
       " 'generator_speed': 2,\n",
       " 'power': 3,\n",
       " 'wind_direction': 4,\n",
       " 'wind_direction_mean': 5,\n",
       " 'yaw_position': 6,\n",
       " 'yaw_speed': 7,\n",
       " 'pitch1_angle': 8,\n",
       " 'pitch2_angle': 9,\n",
       " 'pitch3_angle': 10,\n",
       " 'pitch1_speed': 11,\n",
       " 'pitch2_speed': 12,\n",
       " 'pitch3_speed': 13,\n",
       " 'pitch1_moto_tmp': 14,\n",
       " 'pitch2_moto_tmp': 15,\n",
       " 'pitch3_moto_tmp': 16,\n",
       " 'acc_x': 17,\n",
       " 'acc_y': 18,\n",
       " 'environment_tmp': 19,\n",
       " 'int_tmp': 20,\n",
       " 'pitch1_ng5_tmp': 21,\n",
       " 'pitch2_ng5_tmp': 22,\n",
       " 'pitch3_ng5_tmp': 23,\n",
       " 'pitch1_ng5_DC': 24,\n",
       " 'pitch2_ng5_DC': 25,\n",
       " 'pitch3_ng5_DC': 26,\n",
       " 'group': 27,\n",
       " 'label': 28,\n",
       " 'new_group': 29,\n",
       " 'pitch_angle_mean': 30,\n",
       " 'pitch_angle_sd': 31,\n",
       " 'pitch_speed_mean': 32,\n",
       " 'pitch_speed_sd': 33,\n",
       " 'pitch_moto_tmp_mean': 34,\n",
       " 'pitch_moto_tmp_sd': 35,\n",
       " 'tmp_diff': 36,\n",
       " 'torque': 37,\n",
       " 'cp': 38,\n",
       " 'ct': 39,\n",
       " 'lambda': 40,\n",
       " 'r_wind_speed_to_power': 41,\n",
       " 'r_wind_speed_to_generator_speed': 42,\n",
       " 'r_square': 43,\n",
       " 'wind_speed_square': 44,\n",
       " 'wind_speed_cube': 45}"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 17
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-11-02T01:39:58.013342Z",
     "start_time": "2024-11-02T01:39:57.995342Z"
    }
   },
   "cell_type": "code",
   "source": [
    "l = [1]\n",
    "if l:\n",
    "    print(\"jjj\")"
   ],
   "id": "6676b5660a94847d",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "jjj\n"
     ]
    }
   ],
   "execution_count": 10
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-11-02T02:46:31.429611Z",
     "start_time": "2024-11-02T02:46:31.418607Z"
    }
   },
   "cell_type": "code",
   "source": "set([1,2,1, 53,4,5])",
   "id": "7c8a4b0cd5664ad4",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{1, 2, 4, 5, 53}"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 4
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "",
   "id": "6a67ae9691bddbed"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
